<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<style>

.gy_content_gopy{
    border:1px solid #cacaca;
    width:100%;
    margin: 0 auto;
   
}
.gy_gopy_header{
    background-color: #C9C7C7;
    color:#fff;
    font-weight:bold;
    font-size:14px;
    padding:5px 0px 5px 10px;
}
.gy_inner_gopy{
    padding:10px;
}
.gy_back_list{
    width:80px;
    float: right;
    font-size:12px;
    border:1px solid #A7C5D3;    
    padding:2px 0px 2px 10px;
}
.gy_back_list a {
    color:#595B93;
    text-decoration: none;
}
.gy_back_list a:hover{
    color:#fff;
    text-decoration: none;
}
ul li{
    display:inline;
}
.gy_wraper{
    border:1px solid #cacaca;
    padding:20px;
    width: 600px;
    margin:0 auto;
    background-color:#F2F7F3;
}
.gy_form p{
    margin:0px;
    padding:0px;
}

.gy_ten{
    width:200px;
    background-color: #D1C0C0;
    padding:2px 0px 2px 20px;
    margin-top:10px;
    border:1px 1px 1px 1px solid #cacaca;
    color:#fff;
    font-weight: bold;
    background-repeat: no-repeat;
    background-image: url(<?php echo base_url();?>template/skin/images/user_comment.png);
}
input{
    padding:4px;
    margin:1px;
}
.gy_noidung{
    border:1px solid #cacaca;
    width:500px;
    padding:10px 10px 10px 15px;
}
.gy_noidung a, li a{
    color:#333;
    text-decoration: none;
}
li{
    border:1px solid #cacaca;
    padding:2px;
    margin:1px;
    background-color:#DBDBD9;
}
.gy_current{
    background-color:#BABABA;
}
.gy_header_gopy{
    background-color:#A56F6F;
    padding:15px;
    width:510px;
    color:#fff;
    background-image: url(<?php echo base_url();?>template/skin/images/list_comment.png);
    background-repeat:no-repeat;
}
.gy_header_gopy span{
    padding-left:40px;    
}
#them{
    float:right;
    margin-right:10px;
}
#them a{
    font-weight:bold;
    text-decoration: none;
    color:#FF0000;
}
#them a:hover{
    color:#fff;
}
.gy_loi{
    color:red;
}
</style>
<?php 
    if($this->uri->segment(3,0)=='show'){
        echo '<div class="gy_content_gopy"><div class="gy_gopy_header">';
    if(!empty($dulieu)){echo $dulieu->ten;}
        echo '<span id="them"><a href="'. base_url().'mod_gopy/nd_gopy/add/">Gửi ý kiến</a></span></div><div class="gy_inner_gopy">';
    if(!empty($dulieu)){echo $dulieu->noidung;}
        echo '</div><div class="gy_back_list"><a href="'. base_url().'mod_gopy/nd_gopy/list/">Xem Thêm</a></div></div>';
}elseif($this->uri->segment(3,0)=='list'){
    if(!empty($dulieu)){
        echo '<div class="gy_wraper">
        <div class="gy_header_gopy"><span>Danh sách ý kiến đóng góp:</span><span id="them"><a href="'. base_url().'mod_gopy/nd_gopy/add/">Gửi ý kiến</a></span></div>
        ';
        foreach ($dulieu as $dulieu){            
            echo   '
            <div class="gy_ten">'.$dulieu->ten.'</div>
            <div class="gy_noidung">
                <a href="'.base_url().'mod_gopy/nd_gopy/show/'.$dulieu->id.'">
                    '.word_limiter($dulieu->noidung, 20).'
                </a>
            </div>
            
            ';
        }
        echo '<ul>'.$this->pagination->create_links().'</ul>';
        echo '</div>';
    }
}elseif($this->uri->segment(3,0)=='add'){
    if(!$this->session->userdata('gopy')){
        echo '<h2>Góp ý:</h2><div class="gy_form">';
        $attributes = array('class' => 'form_gopy', 'id' => 'form_gopy');
        echo form_open('mod_gopy/nd_gopy/add/',$attributes);
        echo '
        <input type="text" name="ten" value="'.set_value("ten").'" > Tên  '.form_error('ten').'<br/>
        <input type="text" name="email" value="'.set_value("email").'"> Email  '.form_error('email').'<br/>
        <input type="text" name="dienthoai" value="'.set_value("dienthoai").'"> Điện thoại  '.form_error('dienthoai').'<br/>
        <input type="text" name="tieude" value="'.set_value("tieude").'"> Tiêu đề  '.form_error('tieude').'<br/>
        Nội dung:  '.form_error('noidung').'<br/>
        <textarea cols="70" rows="8" name="noidung" value="'.set_value("noidung").'"></textarea>
        <br/>
        <input type="submit" value="Gửi">
        
        ';
        echo form_close().'</div>';
    }else{
        echo $this->session->userdata('gopy');
    }
    
    
}
 ?>
 